package com.mikasa.springboot.example.kafka;

import com.alibaba.fastjson.JSON;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @Author: zhangyu
 * @Date: 17/4/28.
 * @Description:
 */
@Component
public class KafkaReceiver {

    @KafkaListener(topics = "test1")
    public void processMessage(String content) {
        System.out.println("kafka中的数据:"+content);
        KafkaMessage message = JSON.parseObject(content,KafkaMessage.class);
        System.out.println("kafka中的消息:"+message.getMsg());
    }
}
